package com.heima.listener;

import org.apache.commons.lang3.StringUtils;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class TestListener {

    /**
     * 消费者1
     *
     * @param message 收到的消息
     */
    @KafkaListener(topics = "topic", groupId = "group101")
    public void listener(String message) {
        System.out.println("消费者1");
        System.out.println(message);
    }

    /**
     * 消费者2
     *
     * @param message 收到的消息
     */
    @KafkaListener(topics = "topic", groupId = "group102")
    public void listener2(String message) {
        System.out.println("消费者2");
        System.out.println(message);
    }
}
